#include "Principal.h"

Principal::Principal(QWidget *parent):QWidget(parent)
{
	ui.setupUi(this);

        connect(ui.carregaB, SIGNAL(clicked()), ui.gLWidget1, SLOT(CarregaModel()));
        connect(ui.immediatRB, SIGNAL(clicked()), ui.gLWidget1, SLOT(SeleccionarModeImmediat()));
        connect(ui.vaRB, SIGNAL(clicked()), ui.gLWidget1, SLOT(SeleccionarModeVA()));
        connect(ui.vboRB, SIGNAL(clicked()), ui.gLWidget1, SLOT(SeleccionarModeVBO()));

        connect(ui.vertexShaderB, SIGNAL(clicked()), ui.gLWidget1, SLOT(loadVertexShader()));
        connect(ui.fragmentShaderB, SIGNAL(clicked()), ui.gLWidget1, SLOT(loadFragmentShader()));
        connect(ui.uniformB, SIGNAL(valueChanged(int)), ui.gLWidget1, SLOT(updateUniform(int)));
        connect(ui.uniformB, SIGNAL(valueChanged(int)), ui.unioformLCD, SLOT(display(int)));
        connect(ui.shaderCB, SIGNAL(clicked(bool)), ui.gLWidget1, SLOT(enableGLSLShaders(bool)));

        connect( &timer, SIGNAL(timeout()), this, SLOT(UpdateLCDS()));
        timer.start(1000);
}

void Principal::UpdateLCDS() {
    ui.fpsNumber->display(ui.gLWidget1->getFPS());
    ui.VertexNumber->display(ui.gLWidget1->getVertexCount());
}
